import time

from selenium import webdriver
from selenium.webdriver.common.by import By

# 打开浏览器
driver = webdriver.Chrome()
# 输入网址
driver.get('http://novel.hctestedu.com/user/login.html')
# 浏览器最大化
driver.maximize_window()
# 隐式等待-10秒
driver.implicitly_wait(10)
# 输入账户
el = driver.find_element(By.XPATH, '//*[@id="txtUName"]')
el.send_keys('17730676645')

pwd = driver.find_element(By.XPATH, '//*[@id="txtPassword"]')
pwd.send_keys('413301yl')

driver.find_element(By.XPATH, '//*[@id="btnLogin"]').click()
# 点击全部作品
driver.find_element(By.XPATH, '//*[@id="navModule"]/li[2]/a').click()
# 点击30万字以下
driver.find_element(By.XPATH, '/html/body/div[2]/div[1]/div/ul/li[4]/a[2]').click()
# 强制等待3秒
time.sleep(3)
# 关闭浏览器
driver.quit()
